//
//  HomePageTestController.swift
//  show
//
//  Created by 李威 on 2022/3/22.
//

import UIKit

class HomePageTestController: UIViewController {
    
    var banner: HomeBanner!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        banner = HomeBanner(frame: CGRect(x: 0, y: 100, width: self.view.bounds.size.width, height: 220))
        banner.urls = ["https://dn-miracle-photo.jimu.com/80151421-523b-4738-b9ff-8a60c835e80d",
                       "https://dn-miracle-photo.jimu.com/651671bd-bbef-4d15-ae19-bfbb588109df",
                       "https://dn-miracle-photo.jimu.com/afa360a2-b634-4d09-8d77-b72c58b46dda",
                       "https://dn-miracle-photo.jimu.com/e372199a-65c0-4d6b-b64f-023a06d2797e",
                       "https://dn-miracle-photo.jimu.com/d2ceb029-46d3-4a61-b0da-2900ecd4684c",
                       "https://dn-miracle-photo.jimu.com/05c49c9d-f9c7-43d7-a4eb-a980dce6d527"]
        
        banner.didSelectItem = { index in
            print(index)
        }
        self.view.addSubview(banner)
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        if banner.urls?.count == 1 {
            banner.urls = ["https://dn-miracle-photo.jimu.com/80151421-523b-4738-b9ff-8a60c835e80d",
                           "https://dn-miracle-photo.jimu.com/651671bd-bbef-4d15-ae19-bfbb588109df",
                           "https://dn-miracle-photo.jimu.com/afa360a2-b634-4d09-8d77-b72c58b46dda",
                           "https://dn-miracle-photo.jimu.com/e372199a-65c0-4d6b-b64f-023a06d2797e",
                           "https://dn-miracle-photo.jimu.com/d2ceb029-46d3-4a61-b0da-2900ecd4684c",
                           "https://dn-miracle-photo.jimu.com/05c49c9d-f9c7-43d7-a4eb-a980dce6d527"]
            return
        }
        banner.urls = ["https://dn-miracle-photo.jimu.com/80151421-523b-4738-b9ff-8a60c835e80d"]
    }

}
